//
//  HXPersonKindTableViewCell.m
//  KD
//
//  Created by 高得华 on 16/9/19.
//  Copyright © 2016年 Whx. All rights reserved.
//

#import "HXPersonKindTableViewCell.h"

@interface HXPersonKindTableViewCell ()

@property (nonatomic, strong) UIImageView * selectImageView;
@property (nonatomic, retain) UILabel * nameLabel;

@end

@implementation HXPersonKindTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)setListModel:(HXPersonKindListModel *)listModel{
    _listModel = listModel;
    //判断状态设置label.text的颜色
    if (_listModel.isSelected) {
        self.textLabel.textColor = [UIColor lightGrayColor];
        self.selectImageView.image = [UIImage imageNamed:@"75.pic"];
        
    }else{
        
        self.textLabel.textColor = [UIColor blackColor];
        self.selectImageView.image = [UIImage imageNamed:@"76.pic"];
    }
    self.nameLabel.text = _listModel.typeName;
}


-(UIImageView *)selectImageView{
    if (_selectImageView == nil) {
        _selectImageView = [[UIImageView alloc]init];
        CGFloat cellWidth = 18;
        CGFloat cellHeight = 18;
        _selectImageView.frame = CGRectMake(24, (self.frame.size.height-cellHeight)*0.5, cellWidth, cellHeight);
        _selectImageView.layer.cornerRadius = 9;
        _selectImageView.layer.masksToBounds = YES;
        [self.contentView addSubview:_selectImageView];
    }
    return _selectImageView;
}
-(UILabel *)nameLabel{
    if (_nameLabel == nil) {
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.selectImageView.right + 20, (self.height-30)/2, 120, 30)];
        _nameLabel.font=[UIFont systemFontOfSize:14];
        [self.contentView addSubview:_nameLabel];
    }
    return _nameLabel;
}

@end
